Skip to content

feat(ui,sdk,shared): add UI test coverage and dual ESM+CJS builds - #18

Closed
starfishkrq wants to merge 2 commits into
lumio-network:mainfrom
starfishkrq:feature/8-9-ui-tests-dual-esm-cjs
Closed

starfishkrq wants to merge 2 commits into
lumio-network:mainfrom
starfishkrq:feature/8-9-ui-tests-dual-esm-cjs

Conversation

@starfishkrq

Copy link
Copy Markdown
Contributor

Summary

closes #8
closes #9

This PR implements both open issues in a single cohesive change.


Issue #8 — Expand @lumio/ui test coverage

File changed: packages/ui/src/ui.test.tsx

Added tests following the existing patterns in the file:

  • Card / CardTitle / CardBody — renders children, merges a passed className, forwards ref (Card)
  • Input — defaults type to "text", forwards placeholder, forwards disabled, merges className
  • Buttonsecondary and ghost variant class assertions; sm, md (default), lg size class assertions
  • Badge — all five variants exercised: neutral (default), lumen, teal (pre-existing), coral, sky

Result: 27 tests, all passing (up from 6).


Issue #9 — Dual ESM + CJS builds for all three packages

Strategy: two tsc invocations per package — no new runtime dependencies needed.

Package CJS output ESM output
@lumio/shared dist/cjs/ dist/esm/
@lumio/sdk dist/cjs/ dist/esm/
@lumio/ui dist/cjs/ dist/esm/

Per-package changes:

  • tsconfig.jsonoutDir updated from dist to dist/cjs
  • tsconfig.esm.json (new) — module: ESNext, moduleResolution: Bundler, outDir: dist/esm; uses Bundler resolution to support extensionless imports without requiring .js suffixes in source
  • package.jsonbuild script runs both configs; exports map updated with import/require/types conditions; main points to dist/cjs/index.js, module points to dist/esm/index.js
  • @lumio/ui ./tailwind-preset sub-path also gets both import and require conditions

Validation

  • pnpm lint green
  • pnpm typecheck green
  • pnpm build green (all 3 packages, both CJS + ESM outputs)
  • pnpm test green (55 tests: 27 UI + 25 shared + 3 sdk)

Smoke-check: ESM dist/esm/index.js opens with export * / export {; CJS dist/cjs/index.js opens with Object.defineProperty(exports, "__esModule").

Issue #8 — expand @lumio/ui test coverage:
- Add Card, CardTitle, CardBody render tests (children + className merge + ref)
- Add Input tests: default type=text, placeholder, disabled, className merge
- Add Button size variants (sm, md, lg) and secondary/ghost variant tests
- Add all Badge variants: neutral, lumen, coral, sky (teal already covered)
- 27 tests total, all passing (up from 6)

Issue #9 — ship dual ESM + CJS builds for all three packages:
- Add tsconfig.esm.json per package (module: ESNext, moduleResolution: Bundler, outDir: dist/esm)
- Update tsconfig.json per package to output CJS into dist/cjs (was dist/)
- Update build script in each package.json: tsc -p tsconfig.json && tsc -p tsconfig.esm.json
- Update package.json exports with import/require/types conditions for . entry
- @lumio/ui also exposes ./tailwind-preset with both import and require conditions
- main points to dist/cjs/index.js; module field points to dist/esm/index.js
@coderabbitai

coderabbitai Bot commented Sep 10, 2026

Copy link
Copy Markdown

Important

  • 🔍 Trigger review

This repository does not receive automatic reviews because it has fewer than 10 stars.

⚙️ Run configuration

Configuration used: Organization UI

Review profile: CHILL

Plan: Advanced

Run ID: 6780f2a5-13f7-43ca-a2e8-13377d7f0b9e


Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands.

@starfishkrq starfishkrq closed this by deleting the head repository Sep 10, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

build(sdk): ship dual ESM + CJS builds for all three packages test(ui): cover Card and Input, and the untested Button/Badge variants

2 participants